package com.fenghongzhang.day008test;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import android.os.Bundle;

import java.util.ArrayList;
import java.util.List;

public class Main4Activity extends AppCompatActivity implements LoginFragment.MyListener {
    private ViewPager vp;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main4);

        vp = (ViewPager) findViewById(R.id.vp);


        List<Fragment> list = new ArrayList<>();
        list.add(new LoginFragment());
        list.add(new RegisterFragment());

        FragmentAdapter fragmentAdapter = new FragmentAdapter(getSupportFragmentManager(), list);

        vp.setAdapter(fragmentAdapter);


    }

    @Override
    public void send(int i) {
        vp.setCurrentItem(i);
    }
}
